package com.fxcalibre.fxml.control.listCells;

import javafx.scene.control.Label;
import javafx.scene.control.ListCell;
import javafx.scene.image.Image;
import javafx.scene.image.ImageViewBuilder;
import javafx.scene.layout.HBox;

import com.fxcalibre.syncservices.imdb.parser.TitleResult;

public class TitleImdbCell extends ListCell<TitleResult>
{
	@Override
	public void updateItem(TitleResult item, boolean empty)
	{

		super.updateItem(item, empty);
		if (item != null)
		{
			HBox hBox = new HBox();
			System.out.println(item.getImgUrl());
			if (item.getImgUrl() != null)
			{
				hBox.getChildren().add(ImageViewBuilder.create().image(new Image(item.getImgUrl())).build());
			}
			hBox.getChildren().add(new Label(item.getName()));
			hBox.getChildren().add(new Label(item.getDescription()));
			setGraphic(hBox);
		}
	}
}
